#include "Complex.h"
Complex::Complex() {
(*this).real=1.0;
(*this).imag=1.0;
}
Complex::Complex (double real, double imag){
(*this).real=real;
(*this).imag=imag;
}
Complex Complex::operator+(Complex z){
double real;
double imag;

real=(*this).real+z.getReal();
imag=(*this).imag+z.getImag();

Complex s=Complex(real,imag);
return s;
}

Complex Complex::operator+(double d){
double real;
double imag;

real=(*this).real+d;
imag=(*this).imag;

Complex s=Complex(real,imag);
return s;
}

Complex Complex::operator-(Complex z){
double real;
double imag;

real=(*this).real-z.getReal();
imag=(*this).imag-z.getImag();

Complex dif=Complex(real,imag);
return dif;
}

Complex Complex::operator-(double d){
double real;
double imag;

real=(*this).real-d;
imag=(*this).imag;

Complex dif=Complex(real,imag);
return dif;
}

Complex Complex::operator*(Complex z){
double real;
double imag;

real=(*this).real*z.getReal()-(*this).imag*z.getImag();
imag=(*this).imag*z.getReal()+(*this).real*z.getImag();

Complex p=Complex(real,imag);
return p;
}

Complex Complex::operator*(double d){
double real;
double imag;

real=(*this).real*d;
imag=(*this).imag;

Complex p=Complex(real,imag);
return p;
}

Complex Complex::operator/(Complex z){
double real;
double imag;

real=(((*this).real*z.getReal())+((*this).imag*z.getImag()))/((z.getReal()*z.getReal())+(z.getImag()*z.getImag()));
imag=(((*this).real*z.getImag())-(*this).real*z.getReal())/((z.getReal()*z.getReal())+(z.getImag()*z.getImag()));

Complex i=Complex(real,imag);
return i;
}

Complex Complex::operator/(double d){
double real;
double imag;

real=(*this).real/d;
imag=(*this).imag;

Complex i=Complex(real,imag);
return i;
}

Complex Complex::operator++(){
double real;
double imag;

real=(*this).real+1.0;
imag=(*this).imag;

Complex s=Complex(real,imag);
return s;
}

Complex Complex::operator--(){
double real;
double imag;

real=(*this).real-1.0;
imag=(*this).imag;

Complex s=Complex(real,imag);
return s;
}
bool Complex::operator==(Complex c)
{
    if (((*this).real==c.getReal())&&(*this).imag==c.getImag()) return true;
    else return false;
}
double Complex::getReal() {
double real;
real=(*this).real;
return real;
}
double Complex::getImag() {
double imag;
imag=(*this).imag;
return imag;
}
void Complex::setReal(double real) {
(*this).real=real;
}
void Complex::setImag(double imag) {
(*this).imag=imag;
}
